﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/

#region Imports

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using VisualAgile.IBLL;
using VisualAgile.IDAL;
using VisualAgile.Model;

#endregion


namespace VisualAgile.BLL
{
    public class TaskManager : BaseManager<Task>, ITaskManager
    {
        #region Properties

        public ITaskDao TaskDao { get; set; }

        #endregion

        protected override IBaseDao<Task> getBaseDAO()
        {
            return TaskDao;
        }

        /// <summary>
        /// Create a user (the default value contains the return)
        /// </summary>
        /// <returns></returns>
        public Task NewTask()
        {
            var task = new Task();

            //System configuration can be used
            task.CreateTime = DateTime.Now;
            task.Name = "New Task";
            task.Evaluation = 1.0;
            task.Primary  = true;
            task.CreateDate = DateTime.Now;
           
            return task;
        }

        /// <summary>
        /// Access to Tasks by Story
        /// </summary>
        /// <param name="ProjectName">project Id</param>
        /// <returns></returns>
        public IList GetByStory(string StoryID)
        {
            return TaskDao.FindByStory(StoryID);
        }

        /// <summary>
        /// Access to Tasks by Stories
        /// </summary>
        /// <param name="ProjectName">stories</param>
        /// <returns></returns>
        public IList GetByStories(string Stories)
        {
            return TaskDao.FindByStories(Stories);
        }

        /// <summary>
        /// Access to Tasks by Status
        /// </summary>
        /// <param name="ProjectName">project Id</param>
        /// <returns></returns>
        public IList GetByStatus(string StatusID)
        {
            return TaskDao.FindByStatus(StatusID);
        }

        /// <summary>
        /// Access to non-catagorized tasks
        /// </summary>        
        /// <returns>Tasks</returns>
        public IList GetNonCatagorizedTasks()
        {
            return TaskDao.FindNonCatagorizedTasks();
        }

        /// <summary>
        /// Access to Tasks by Iteration
        /// </summary>
        /// <param name="ProjectName">project Id</param>
        /// <returns></returns>
        public IList GetByIteration(string IterationID)
        {
            return TaskDao.FindByIteration(IterationID);
        }
    }
}
